# from collections import namedtuple
# # Point = namedtuple('Point',['x', 'y'])
# print(type(Point))
# p = Point(1, 2)
# print(type(p))
# print(p)  # Point(x=1, y=2)
# print(p[0])
# print(p[1])
# print(p.x)
# print(p.y)
# import time
# struct_time = time.strptime('2019-7-2','%Y-%m-%d')
# print(struct_time)
# print(struct_time[0])
# print(struct_time.tm_yday)
# struct_time(tm_year=2019, tm_mon=7, tm_mday=2, )
# from collections import namedtuple
# struct_time = namedtuple('struct_time',['tm_year', 'tm_mon', 'tm_mday'])
# st = struct_time(2019, 7, 2)
# print(st)

#deque: 类似于列表的一种容器型数据,插入元素删除元素效率高.
# from collections import deque
# q = deque(['a', 1, 'c', 'd'])
# print(q)
# q.append('e')
# q.append('f')
# print(q)
# q.appendleft('ly')
# q.appendleft('dsb')
# print(q)
# q.pop()
# q.popleft()
# print(q)

# 按照索引取值
# print(q[0])

# 按照索引删除任意值
# del q[2]
# print(q)
# q.insert(1,'2')
# print(q)

# d = dict([('a', 1), ('b', 2), ('c', 3)])
# print(d)
# from collections import OrderedDict
# od = OrderedDict([('a', 1), ('b', 2), ('c', 3)])
# # print(od)
# print(od['a'])
# print(od['b'])


from collections import defaultdict
# # 默认值字典
# l1 = [11, 22, 33, 44, 55, 77, 88, 99]
# dic = {}
# for i in l1:
#     if i < 66:
#         if 'key1' not in dic:
#             dic['key1'] = []
#         dic['key1'].append(i)
#
#     else:
#         if 'key2' not in dic:
#             dic['key2'] = []
#         dic['key2'].append(i)
# print(dic)


# l1 = [11, 22, 33, 44, 55, 77, 88, 99]
# # dic = defaultdict(list)
# # for i in l1:
# #     if i < 66:
# #         dic['key1'].append(i)
# #
# #     else:
# #         dic['key2'].append(i)
# # print(dic)
# callable
# dic = defaultdict(list)  # 需要一个可回调的
# dic['1'] = 222
# dic['2']
# dic['3']
# print(dic)

# print(list())
# print(list())
# dic = dict.fromkeys('123',[])
# print(dic)

# dic = defaultdict(lambda :None)
# # dic = defaultdict(None)
# for i in range(1,4):
#     dic[i]
# print(dic)

# from collections import Counter
# c = Counter('flkjdasffdfakjsfdsaklfdsalf')  # 计数器
# print(c)
# print(c['f'])